package com.itheima.d4_map;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;

public class MapTest1 {
    public static void main(String[] args) {
        //Map<String,Integer> map =new HashMap<>();//map按照键，无序，不重复，无索引
        Map<String,Integer> map =new LinkedHashMap<>();//map按照键，有序，不重复，无索引


        map.put("手表",100);
        map.put("手表",120);
        map.put("手机",20);
        map.put("Java",2);
        map.put(null,null);
        System.out.println(map);

        Map<Integer,String> map1 =new TreeMap<>();//可排序(默认升序)，不重复，无索引
        map1.put(23,"java");
        map1.put(23,"mysql");
        map1.put(21,"wanggang1");
        map1.put(29,"wangleilei");
        System.out.println(map1);
    }
}
